From 7d0aeaacea0ac1a7855fa2cb17f8cfe3a99e0c08 Mon Sep 17 00:00:00 2001 From: "kaf24@localhost.localdomain" Date: Sat, 19 Aug 2006 10:20:08 +0100 Subject: [PATCH] [NET/BLK] back: Change the netback and blkback device drivers to allow and handle frontend state transition from "Closing" to "Initialising". Instead of destroying the backend device then they wait for a reconnect from the frontend. Needed for domU kexec support, to hand over devices from one kernel instance to the next. Signed-off-by: Gerd Hoffmann --- linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c | 5 +++++ linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c | 15 +++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c b/linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c index ca01d15595..0f268c9e33 100644 --- a/linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c +++ b/linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c @@ -305,6 +305,11 @@ static void frontend_changed(struct xenbus_device *dev, switch (frontend_state) { case XenbusStateInitialising: + if (dev->state == XenbusStateClosing) { + printk("%s: %s: prepare for reconnect\n", + __FUNCTION__, dev->nodename); + xenbus_switch_state(dev, XenbusStateInitWait); + } break; case XenbusStateInitialised: diff --git a/linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c b/linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c index 6bb87a636e..a0e3961234 100644 --- a/linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c +++ b/linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c @@ -234,10 +234,25 @@ static void frontend_changed(struct xenbus_device *dev, switch (frontend_state) { case XenbusStateInitialising: + if (dev->state == XenbusStateClosing) { + printk("%s: %s: prepare for reconnect\n", + __FUNCTION__, dev->nodename); + if (be->netif) { + netif_disconnect(be->netif); + be->netif = NULL; + } + xenbus_switch_state(dev, XenbusStateInitWait); + } + break; + case XenbusStateInitialised: break; case XenbusStateConnected: + if (!be->netif) { + /* reconnect: setup be->netif */ + backend_changed(&be->backend_watch, NULL, 0); + } maybe_connect(be); break; -- 2.30.2